<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Cross Compiling</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"/><LINK
REL="HOME"
TITLE="Cygwin/X Contributor's Guide"
HREF="cygwin-x-cg.html"/><LINK
REL="UP"
TITLE="Programming"
HREF="programming.html"/><LINK
REL="PREVIOUS"
TITLE="Native Compiling"
HREF="prog-build-native.html"/><LINK
REL="NEXT"
TITLE="Contributing Patches"
HREF="prog-patches.html"/><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html;charset=utf-8"/></HEAD
><BODY
CLASS="sect1"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Cygwin/X Contributor's Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="prog-build-native.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. Programming</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="prog-patches.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"/></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="prog-build-cross"
>Cross Compiling</A
></H1
><P
>Cross compiling is the act of the building source code on one
system, the build host, into executables or libraries to be run on a
different host, the target host.  The build host and the target host
may differ in operating system and/or processor type.</P
><P
>Cross compiling is much trickier than building on the native
host.  There are a whole new class of problems that can happen when
cross compiling that are simply not an issue when building on
Cygwin.  You should be familiar with building Cygwin/X on Cygwin,
as described in <A
HREF="prog-build-native.html"
>the Section called <I
>Native Compiling</I
></A
>, before
attempting to cross compile Cygwin/X.</P
><P
>See <A
HREF="cross.html"
>Appendix A</A
> for notes on building a cross
compiler.</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="prog-cross-build"
>Building Cygwin/X</A
></H2
><P
>Building the source code when cross compiling X Window System is nearly
identical to the process described below in
<A
HREF="prog-build-native.html"
>the Section called <I
>Native Compiling</I
></A
> of the Native Compiling
section.  One divergence from the aforementioned instructions is that
you will be using a <B
CLASS="command"
>bash</B
> shell on your cross
compiling host, rather than on your native Cygwin host.</P
><OL
TYPE="1"
><LI
><P
>When configuring, you must pass
<CODE
CLASS="parameter"
>--target=i686-pc-cygwin</CODE
> to <B
CLASS="command"
>./configure</B
> to
cause the build system to build for the target, Cygwin,
platform:</P
></LI
><LI
><P
>When installing a build, you must
pass <CODE
CLASS="parameter"
>DESTDIR=/stagingdir</CODE
> to <B
CLASS="command"
>make install</B
> to
install the target platform build into <TT
CLASS="filename"
>/stagingdir</TT
>.
</P
><DIV
CLASS="tip"
><BLOCKQUOTE
CLASS="tip"
><P
><B
>Tip: </B
>Never run <B
CLASS="command"
>make install</B
> on your
host platform without the <CODE
CLASS="parameter"
>DESTDIR</CODE
> parameter, as
that will cause the Cygwin build of X Window System to be installed over top
of your local X Window System installation, which would completely
destroy your host system's X Window System installation.</P
></BLOCKQUOTE
></DIV
><P
>OR, when configuring, you can pass
<CODE
CLASS="parameter"
>--prefix=/stagingdir</CODE
> to <B
CLASS="command"
>./configure</B
> to
cause the build system to be configured to install the target platform build into
<TT
CLASS="filename"
>/stagingdir</TT
>.
This avoids the possibilty of installing over the native installation, at the
cost of baking the prefix <TT
CLASS="filename"
>/stagingdir</TT
>
into the target binaries.
</P
></LI
></OL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"/><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="prog-build-native.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="cygwin-x-cg.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="prog-patches.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Native Compiling</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="programming.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Contributing Patches</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>